package com.spm.librarianmanagersystem.controller;

import com.spm.librarianmanagersystem.service.DeleteService;
import com.spm.librarianmanagersystem.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/user")
public class DeleteController {

    @Autowired
    private DeleteService deleteService;

    @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
    public JsonResult deleteUser(@RequestBody Integer user_id){
        boolean flag = deleteService.deleteUser(user_id);
        if(flag){
            return new JsonResult();
        }else{
            return new JsonResult(500,"删除失败");
        }
    }
}
